package com.ay.weixin.fdc.front.usercenter.event;

import java.io.IOException;

import javax.servlet.ServletException;

import org.lizar.config.keys.Keys;
import org.lizar.controller.Event;
import org.lizar.controller.loader.EventLoader;

import com.ay.weixin.config.ProjectConfig;

public class InviteSuccess extends Event {

	@Override
	public void init_property() throws Exception {

	}

	@Override
	public String default_handling_path() {
		return "/fdc/invite_success/*";
	}

	@Override
	public void handle(EventLoader el) throws ServletException, IOException {
		long wxproject_id=el.queryPathInt(2);
		if(!el.getBool("is_weixin")&&ProjectConfig._bool(wxproject_id,"sys.weixin_only")){
			el.text("invalid visit");
			return;
		}
		if(el.getSessionAttr("user")!=null){
			el.response_to_root("/fdc/usercenter/"+wxproject_id);
		}else{
			el.template("/WEB-INF/template/app/"+wxproject_id+"/fdc/register.vm");
		}
		
	}

}
